<div class="form">
    <?php
    /** @var CartaAlimentosController $this */
    /** @var CartaAlimentos $model */
    /** @var AweActiveForm $form */
    Util::tsRegisterAssetJs('alimentos.js');

    $form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
        'id' => 'carta-alimentos-form',
        'enableAjaxValidation' => false,
        'enableClientValidation' => true,
    ));
    ?>

    <p class="note">
        <?php echo Yii::t('AweCrud.app', 'Fields with') ?> <span class="required">*</span>
        <?php echo Yii::t('AweCrud.app', 'are required') ?>.    </p>

    <?php echo $form->errorSummary($model) ?>
    <div class="row-fluid">
        <div class="span5">
            <?php echo $form->dropDownListRow($model, 'carta_nutricional_id', array('' => ' -- Seleccione -- ') + CHtml::listData(CartaNutricional::model()->findAll(), 'id', CartaNutricional::representingColumn())) ?>
        </div>

        <div class="span5">
            <?php echo $form->dropDownListRow($model, 'alimentos_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Alimentos::model()->findAll(), 'id', Alimentos::representingColumn())) ?>
        </div>  
       <div class="row-fluid">
        <div class="span5">
        <?php
        $dataProvider = new ValoresNutricionales('search');
        $this->widget('ext.selgridview.BootSelGridView', array(
            'id' => 'alimentos-grid',
            'type' => 'striped bordered hover advance',
            'selectableRows' => 2,
            'dataProvider' => $dataProvider->search(),
            'columns' => array(
                array(
                    'name' => 'alimentos',
                    'id' => 'check',
                    'class' => 'CCheckBoxColumn',
                    'value' => '$data->id',
                ),
//                'alimentos_id',
                array(
//                    'name' => 'alimentos_id',
                    'header' => 'Alimento',
                    'value' => '$data->alimentos->nombre',
                ),
            ),
        ));
        ?>
    </div>
        <div class="span5">
            <!--<p>TODO agregar en un renderpartial los valroes nutricionaels</p>-->
        </div>
    </div>
    </div>
        <div class="form-actions">
            <?php
            $this->widget('bootstrap.widgets.TbButton', array(
                'buttonType' => 'submit',
                'type' => 'primary',
                'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'),
            ));
            ?>
            <?php
            $this->widget('bootstrap.widgets.TbButton', array(
                //'buttonType'=>'submit',
                'label' => Yii::t('AweCrud.app', 'Cancel'),
                'htmlOptions' => array('onclick' => 'javascript:history.go(-1)')
            ));
            ?>
        </div>

        <?php $this->endWidget(); ?>
    </div>